package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.GoodsSalesDTO;
import com.sky.dto.OrdersPageQueryDTO;
import com.sky.entity.Orders;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

@Mapper
public interface OrderMapper {
    /*向订单表中添加数据*/
    public void insert(Orders orders);

    /**
     * 根据订单号查询订单
     *
     * @param orderNumber
     */
    @Select("select * from orders where number = #{orderNumber}")
    public Orders getByNumber(String orderNumber);

    /**
     * 修改订单信息
     *
     * @param orders
     */
    public void update(Orders orders);

    public Page<Orders> pageQuery(OrdersPageQueryDTO ordersPageQueryDTO);

    public Orders getById(Long id);

    /*根据订单类型计算订单数量*/
    public Integer getConutByOrderType(Integer orderStatus);

    public List<Orders> getOrderByStatusAndOrderTimeLT(Integer status, LocalDateTime orderTime);

    public Double sumByMap(HashMap<Object, Object> conditionMap);

    public Integer countByMap(HashMap<Object, Object> conditionMap);

    ArrayList<GoodsSalesDTO> getSalesTop10(LocalDateTime begin, LocalDateTime end);
}
